package com.hefei.hight;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Set;

/**
 * @author caizhengjun
 * @date 2020/9/4 9:02 下午
 */
public class Test06 {
    public static void main(String[] args) {
        Set<String> zoneIds = ZoneId.getAvailableZoneIds();
        for (String s : zoneIds) {
            //System.out.println(s);
        }

        LocalDateTime localDateTime = LocalDateTime.now(ZoneId.of("America/New_York"));

        System.out.println("America/New_York " + localDateTime);

        localDateTime = LocalDateTime.now(ZoneId.of("Etc/GMT-8"));

        System.out.println("Etc/GMT-8 " + localDateTime);

        ZonedDateTime zonedDateTime = ZonedDateTime.now();
        System.out.println(zonedDateTime);

        ZonedDateTime zonedDateTime1 = ZonedDateTime.now(ZoneId.of("Asia/Tokyo"));
        System.out.println(zonedDateTime1);

    }

}
